#ifndef IO_FLT_GROUP_H_
#define IO_FLT_GROUP_H_

#ifdef __cplusplus
extern "C"
{
#endif

#include "stdint.h"
#include "mytype.h"

	struct io8_flt_struct
	{
		byte_tt val;
		byte_tt val_old;
		byte_tt read_old;
		byte_tt edge;
		byte_tt edge_found;
		byte_tt edge_lost;
		uint8_t flt_cnt;
	};

	struct io16_flt_struct
	{
		word_tt val;
		word_tt val_old;
		word_tt read_old;
		word_tt edge;
		word_tt edge_found;
		word_tt edge_lost;
		word_tt flt_cnt;
	};

	struct io32_flt_struct
	{
		dword_tt val;
		dword_tt val_old;
		dword_tt read_old;
		dword_tt edge;
		dword_tt edge_found;
		dword_tt edge_lost;
		dword_tt flt_cnt;
	};

	typedef struct io8_flt_struct io8_flt_type;
	typedef struct io16_flt_struct io16_flt_type;
	typedef struct io32_flt_struct io32_flt_type;

	void io8_flt(io8_flt_type *io_obj, uint8_t flt_sv, uint8_t read_now, uint8_t pulse);
	void io16_flt(io16_flt_type *io_obj, uint8_t flt_sv, uint16_t read_now, uint8_t pulse);
	void io32_flt(io32_flt_type *io_obj, uint8_t flt_sv, uint32_t read_now, uint8_t pulse);

	void io8_flt2(io8_flt_type *io_obj, uint8_t read_now, uint8_t pulse);
	void io16_flt2(io16_flt_type *io_obj, uint16_t read_now, uint8_t pulse);
	void io32_flt2(io32_flt_type *io_obj, uint32_t read_now, uint8_t pulse);

	void io8_flt2s(io8_flt_type *io_obj, uint8_t read_now, uint8_t pulse);
	void io16_flt2s(io16_flt_type *io_obj, uint16_t read_now, uint8_t pulse);
	void io32_flt2s(io32_flt_type *io_obj, uint32_t read_now, uint8_t pulse);

	struct io08_flt4s_struct
	{
		byte_tt val;
		byte_tt val_old;
		byte_tt read_old[3];
		byte_tt edge;
		byte_tt edge_found;
		byte_tt edge_lost;
	};
	typedef struct io08_flt4s_struct io08_flt4s_type;
	void io08_flt4s(io08_flt4s_type *io_obj, uint8_t read_now, uint8_t pulse);

	struct io16_flt4s_struct
	{
		word_tt val;
		word_tt val_old;
		word_tt read_old[3];
		word_tt edge;
		word_tt edge_found;
		word_tt edge_lost;
	};
	typedef struct io16_flt4s_struct io16_flt4s_type;
	void io16_flt4s(io16_flt4s_type *io_obj, uint16_t read_now, uint8_t pulse);

	struct io32_flt4s_struct
	{
		dword_tt val;
		dword_tt val_old;
		dword_tt read_old[3];
		dword_tt edge;
		dword_tt edge_found;
		dword_tt edge_lost;
	};
	typedef struct io32_flt4s_struct io32_flt4s_type;
	void io32_flt4s(io32_flt4s_type *io_obj, uint32_t read_now, uint8_t pulse);

	struct io8_b_flt_struct
	{
		byte_tt val;
		byte_tt edge_found;
		byte_tt edge_lost;
		uint8_t val_old;
		uint8_t read_old[8];
	};

	struct io16_b_flt_struct
	{
		word_tt val;
		word_tt edge_found;
		word_tt edge_lost;
		uint16_t val_old;
		uint16_t read_old[8];
	};

	struct io32_b_flt_struct
	{
		dword_tt val;
		dword_tt edge_found;
		dword_tt edge_lost;
		uint32_t val_old;
		uint32_t read_old[8];
	};

	typedef struct io8_b_flt_struct io8_b_flt_type;
	typedef struct io16_b_flt_struct io16_b_flt_type;
	typedef struct io32_b_flt_struct io32_b_flt_type;

	void io8_b_flt(io8_b_flt_type *io_obj, uint8_t flt_sv, uint8_t read_now, uint8_t pulse);
	void io16_b_flt(io16_b_flt_type *io_obj, uint8_t flt_sv, uint16_t read_now, uint8_t pulse);
	void io32_b_flt(io32_b_flt_type *io_obj, uint8_t flt_sv, uint32_t read_now, uint8_t pulse);

	struct io8_simp_flt_struct
	{
		byte_tt val;
		byte_tt read_old;
		uint8_t flt_cnt;
	};

	struct io16_simp_flt_struct
	{
		word_tt val;
		word_tt read_old;
		word_tt flt_cnt;
	};

	struct io32_simp_flt_struct
	{
		dword_tt val;
		dword_tt read_old;
		dword_tt flt_cnt;
	};

	typedef struct io8_simp_flt_struct io8_simp_flt_type;
	typedef struct io16_simp_flt_struct io16_simp_flt_type;
	typedef struct io32_simp_flt_struct io32_simp_flt_type;

	void io8_simp_flt(io8_simp_flt_type *io_obj, uint8_t flt_sv, uint8_t read_now);
	void io16_simp_flt(io16_simp_flt_type *io_obj, uint8_t flt_sv, uint16_t read_now);
	void io32_simp_flt(io32_simp_flt_type *io_obj, uint8_t flt_sv, uint32_t read_now);

#ifdef __cplusplus
}
#endif

#endif 
